package com.xbongbong.pro.webexport.dto;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.pojo.ExcelPartialExportPojo;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author feng.zheng
 * @version v1.0
 * @date 2019/6/8 14:13
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class WorkReportExportDTO extends BaseDTO {
    /**
     * 分组id
     */
    private Long listGroupId;
    /**
     * 报告类型
     */
    private Integer type;
    /**
     * 报告日期
     */
    private JSONArray reportDate;
    /**
     * 业务类型
     */
    @NotNull
    private Integer businessType;
    /**
     * 子业务类型
     */
    @NotNull
    private Integer subBusinessType;
    /**
     * 人员或部门id
     */
    private String pid;
    /**
     * 人员或部门
     */
    private String treeType;
    /**
     * saas移动端顶部筛选项
     */
    private String tab;
    /**
     * 排序字段{"field":"updateTime","sort":"acs"}
     */
    private Map<String,String> sortMap;

    /**
     * 内容模糊查询
     */
    private String nameLike;

    /**
     * 特殊列表筛选
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String creatorId;
    /**
     * 范围筛选
     */
    private JSONObject rangeScreen;

    /**
     * 搜索条件
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private List<ConditionsEntityExt> conditions = new ArrayList<>();
    /**
     * 部分导出
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private ExcelPartialExportPojo excelPartialExportPojo;
    /**
     * 是否是部分导出,1为部分导出
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer partialExport;

    public void setReportDate(JSONArray reportDate) {
        this.reportDate = reportDate == null ? new JSONArray() : reportDate;
    }
}
